package com.icode.web.frontController.house;

import com.icode.core.dto.about.IntroduceDTO;
import com.icode.core.shared.HomeAboutHandle;
import com.icode.service.about.HomeAboutService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Created with IntelliJ IDEA.
 * User: xianfei
 * Date: 15-3-27
 * Time: 上午9:22
 * To change this template use File | Settings | File Templates.
 */
@Controller
@RequestMapping("/front/about")
public class HomeAboutFrontController {

    @Autowired
    HomeAboutService homeAboutService;

    @RequestMapping(value = "default")
    public String about(Model model) {
        IntroduceDTO introduceDTO = homeAboutService.findIntroduce();
        model.addAttribute("objectDTO", introduceDTO);
        return "/front/about";
    }

    @RequestMapping("show/{type}")
    public String show(@PathVariable String type, Model model) {
        HomeAboutHandle.showByType(type, homeAboutService, model);
        return "/front/about";
    }

}
